<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import = "javax.servlet.http.Cookie" %>
<%@page import="jdbc.JdbcDao"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<%

String sid = request.getSession().getId();
Cookie ck = null;
String email = null;

for (Cookie i : request.getCookies())
	if (i.getName().equals("email"))
		ck = i;

JdbcDao mysql = new JdbcDao();

if (ck != null) {
	email = ck.getValue();
	mysql.changeUserContent(email, "session", "");
	response.addCookie(new Cookie("email", ""));
}

// TODO: no hard code here
response.sendRedirect("/Info/main/index.jsp");

%>
<h1><%=email%></h1>
</body>
</html>